home *** CD-ROM | disk | FTP | other *** search
/ DOpus Plus / DOpus Plus.iso / Enhancements / ThemeConvert / Rexx / ThemeConv4.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1998-10-23  |  3.3 KB  |  122 lines

  1. /*
  2. $VER: ThemeConv 0.4 (22.10.98)
  3. Brute force Windows theme converter
  4.  
  5. From DOpus:
  6.  
  7. ARexx   ThemeConv.rexx {Ql} {Qd}
  8.  
  9. From shell:
  10.  
  11. rx ThemeConv.rexx RAM: HD0:
  12.  
  13.  
  14. This script will convert the following files from a normal Windows theme
  15. archive:
  16.  
  17. #?.wav -> #?.8svx      Sound files from WAV to 8SVX
  18. #?.ico -> #?.info      Icon files (NewIcons)
  19. #?.ani -> #?.anim      Animation files from AVI to ANIM5
  20.  
  21. NOTE: Requires rexxtricks.library and an icon in T: called 'dummy.info'
  22.  
  23. */
  24.  
  25. options results
  26. parse arg shandle dhandle .
  27. address 'DOPUS.1'
  28.  
  29. if ~datatype(shandle,'n') & ~datatype(dhandle,'n') then do
  30.   inpath = shandle
  31.   outpath = dhandle
  32.   end
  33. else do
  34.   if shandle = '' | dhandle = '' then do
  35.     dopus request '"No SOURCE or DESTINATION lister given!" Duh!'
  36.     exit
  37.     end
  38.  
  39.   lister query shandle path
  40.   inpath = result
  41.   lister query dhandle path
  42.   outpath = result
  43.   end
  44.  
  45. if index(inpath,":") = 0 then inpath = inpath":"
  46. else if (right(inpath,1) ~= "/") & (right(inpath,1) ~= ":") then inpath = inpath"/"
  47.  
  48. if index(outpath,":") = 0 then outpath = outpath":"
  49. else if (right(outpath,1) ~= "/") & (right(outpath,1) ~= ":") then outpath = outpath"/"
  50.  
  51. if ~exists(inpath) | ~exists(outpath) then do
  52.   dopus request '"One of the supplied paths does not exist!" OK'
  53.   exit
  54.   end
  55.  
  56. if ~show('l','rexxtricks.library') then
  57.   if ~addlib('rexxtricks.library',0,-30) then exit
  58.  
  59. call getdir(inpath,'#?.ico','icons','f','p')
  60. call getdir(inpath,'#?.ani','anims','f','p')
  61. call getdir(inpath,'#?.wav','waves','f','p')
  62. if icons.0 ~= 0 then call qsort('icons')
  63. if anims.0 ~= 0 then call qsort('anims')
  64. if waves.0 ~= 0 then call qsort('waves')
  65.  
  66. address command 'Copy dummy.info T:'
  67. call pragma('d','T:')
  68.  
  69. if icons.0 ~= 0 then call Icons
  70. if anims.0 ~= 0 then call Animations
  71. if waves.0 ~= 0 then call Waves
  72.  
  73. address command 'Delete T:~(dopus|Command|dummy.inf)#? ALL FORCE QUIET'
  74. exit
  75.  
  76. Icons:
  77. do i = 1 to icons.0
  78.   address command 'cur2ilbm "'icons.i'"'
  79.   pattern = substr(left(icons.i,lastpos('.',icons.i) - 1),pos(':',icons.i) + 1)||'#?.ilbm'
  80.   call getdir('T:',pattern,'itemp','f','n')
  81.   if itemp.0 ~= 0 then do
  82.     call qsort('itemp')
  83.     outname = outpath||substr(translate(left(icons.i,lastpos('.',icons.i)),'_',' '),pos(':',icons.i) + 1)||'info'
  84.     address command 'Copy >NIL: T:dummy.info 'outname
  85.     cmd = 'InjectBrush 'outname' "'itemp.1'" "'itemp.2'" FORCE'
  86.     address command cmd
  87.     if rc ~= 0 then address command 'InjectBrush 'outname' "'itemp.1'" "'itemp.1'" FORCE'
  88.     do j = 1 to itemp.0
  89.       call delete('"'itemp.j'"')
  90.     end
  91.     end
  92. end
  93. return
  94.  
  95. Animations:
  96. do i = 1 to anims.0
  97.   address command 'cur2ilbm "'anims.i'"'
  98.   pattern = substr(left(anims.i,lastpos('.',anims.i) - 1),pos(':',anims.i) + 1)||'.ilbm.???'
  99.   call getdir('T:',pattern,'atemp','f','n')
  100.   if atemp.0 ~= 0 then do
  101.     call qsort('atemp')
  102.     call open('tempfile','T:animlist','w')
  103.     do j = 1 to atemp.0
  104.       call writeln('tempfile','8 'atemp.j)
  105.     end
  106.     call close('tempfile')
  107.     outname = outpath||substr(translate(left(anims.i,lastpos('.',anims.i)),'_',' '),pos(':',anims.i) + 1)||'anim'
  108.     call delete(outname)
  109.     address command 'MkAnim USING T:animlist TO "'outname'"'
  110.     call delete('T:animlist')
  111.     end
  112. end
  113. return
  114.  
  115. Waves:
  116. do i = 1 to waves.0
  117.   outname = outpath||substr(translate(left(waves.i,lastpos('.',waves.i)),'_',' '),pos(':',waves.i) + 1)||'8svx'
  118.   call delete(outname)
  119.   address command 'Xto8SVX "'waves.i'" 'outname
  120. end
  121. return
  122.